#include<iostream>
using namespace std;
typedef long long LL;
const LL Mod = 998244353;
const int N = 5010;
int f[N];
int arr[N];
int n, m;
int main()
{
    cin >> n >> m;
	for (int i = 1; i <= m; i++) {
		cin >> arr[i];
	}
	f[0] = 1;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			if (i >= arr[j]) {
				f[i] += f[i - arr[j]];
				f[i] %= Mod;
			}
		}
	}
	cout << f[n] % Mod << endl;
	return 0;
}